﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>JS Loops Exercise 3</title>
    <link href="styles/js-console.css" rel="stylesheet" />
</head>
<body>
    <h1>Finds the max and min number from a sequence of numbers</h1>
    <div id="js-console"></div>
    <script src="scripts/js-console.js"></script>
    <script>
        var numbers = [10, 3, 4, 3, -3, 21];
        var min = numbers[0];
        var max = numbers[0];

        for (var i = 1; i < numbers.length; i++)
        {
            if (numbers[i] < min)
            {
                min = numbers[i];
            }
            if (numbers[i] > max)
            {
                max = numbers[i];
            }
        }

        jsConsole.writeLine("min: " + min + " max: " + max);
    </script>
</body>
</html>
